import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

const router = new Router({
	mode: 'history',
	routes: [{
			path: '/',
			name: 'home',
			meta: {
				title: '首页'
			},
			component: () => import('@/views/index')
		},
		{
			path: '/institute_introduction',
			name: 'instituteIntroduction',
			meta: {
				title: '机构介绍'
			},
			component: () => import('@/views/institute_introduction')
		},
		{
			path: '/industry_policy',
			name: 'industryPolicy',
			meta: {
				title: '产业政策'
			},
			component: () => import('@/views/industry_policy')
		},
		{
			path: '/news',
			name: 'news',
			meta: {
				title: '新闻'
			},
			component: () => import('@/views/news')
		},
		{
			path: '/file',
			name: 'file',
			meta: {
				title: '文件'
			},
			component: () => import('@/views/file')
		},
		{
			path: '/about',
			name: 'about',
			meta: {
				title: '联系我们'
			},
			component: () => import('@/views/about')
		},
		{
			path: '/details_page',
			name: 'detailsPage',
			meta: {
				title: '详情'
			},
			component: () => import('@/views/details_page')
		},
		{
			path: '/project_introduction',
			name: 'projectIntroduction',
			meta: {
				title: '项目介绍'
			},
			component: () => import('@/views/project_introduction')
		},
		{
			path: '/project_list',
			name: 'projectList',
			meta: {
				title: '项目介绍'
			},
			component: () => import('@/views/project_list')
		},
		{
			path: '/publicity_list',
			name: 'publicityList',
			meta: {
				title: '公示专区'
			},
			component: () => import('@/views/publicity_list')
		},
		{
			path: '/file_list',
			name: 'fileList',
			meta: {
				title: '文件'
			},
			component: () => import('@/views/file_list')
		},
		{
			path: '/policy_list',
			name: 'policyList',
			meta: {
				title: '产业政策'
			},
			component: () => import('@/views/policy_list')
		},
		
	]
})

router.beforeEach((to, from, next) => { // beforeEach是router的钩子函数，在进入路由前执行
	// if (to.meta.title) {
	// 	//document.title = to.meta.title;
		
	// }
	document.documentElement.scrollTop = 0
	next() // 执行进入路由，如果不写就不会进入目标页
})

router.afterEach(() => {

})

export default router
